package com.moniteach.activity;

import com.moniteach.R;

import android.app.Activity;
import android.os.Handler;
import android.view.Gravity;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

public abstract class CommonActivity extends Activity {

	protected Handler mHandler;

	protected abstract void initForm();

	protected abstract String getTitlePage();

	@Override
	protected void onResume() {
		super.onResume();
		if (getTitlePage() != null)
			((TextView) (findViewById(R.id.tvTitlePage)))
					.setText(getTitlePage());
	}

	public void showToast(final String msg) {
		mHandler.post(new Runnable() {
			@Override
			public void run() {
				Toast toast = Toast.makeText(CommonActivity.this, msg,
						Toast.LENGTH_LONG);
				toast.setGravity(Gravity.CENTER, 0, 0);
				toast.show();
			}
		});
	}

	public void clickBack(View view) {
		CommonActivity.this.finish();
	}

}
